<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  自定义首页
  <a href="#" class="reg-link">注册</a>

  <form action="/api/users/register" method="post">
    <input type="text" name="username" placeholder="username"><br>
    <input type="password" name="password" placeholder="password"><br>
    <input type="submit" value="register">
  </form>

  <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
  <script>
    $('.reg-link').click((e) => {
      e.preventDefault()
      $.ajax({
        url: 'http://localhost:3000/api/users/register?username=xiaoming&password=123456',
        success: (res) => {
          console.log(res)
        }
      })
    })
  </script>
</body>
</html>